#pragma once
#include "aDataPartBase.h"
#include "GameModuleDependence.h"
#include "TriggerListener.h"
#include "GVContainer.h"
#include "MessageSender.h"



namespace _DATAPART_
{
	namespace _GAME_
	{
		class GamePart:
			public _FOGGE_::_GDB_::aDataPartBase,
			public _MODULE_::_GAME_::TriggerListener,
			public _FO_GDB::GVContainer,
			public _FOGGE_::_MSG_::MessageSender
			
		{
			FoDeclareRTTI;
		public:
			GamePart(void);
		public:
			~GamePart(void);
			GamePart* AttachPart(GamePart* ptrPart);
			virtual void Update(float elapsedtime){	}
			void SetDesiredLocation(const _FOMATH::Vector& newloc);
			void SetDesiredRotation(const _FOMATH::Rotator& newrot);

			void SetParent(GamePart* ptrParent);

			GamePart* GetParent()
			{
				return m_ptrParent;
			}

			GamePart* GetAncestor()
			{
				if(m_ptrParent)
					return m_ptrParent->GetAncestor();
				else
				    return this;
			}

		protected:
			float m_fAccumedTime;
		private:
			std::list<GamePart*> m_listChild;
			GamePart* m_ptrParent;
		
		};
	}
}

namespace _DATAPARTFACTORY_
{
	namespace _GAME_
	{
		class GamePartFactory
			:public _FOGGE_::_GDB_::aDataPartFactoryBase
		{
		public:
			GamePartFactory(void);
			~GamePartFactory(void);

			virtual _FOGGE_::_GDB_::aDataPartBase* GetNewPart();

			_FOGGE_::_GDB_::aDataPartBase* CreatePart();

			
			_FOGGE_::_GDB_::aDataPartBase* LoadPart(TiXmlNode* ptrNode);
		
		};
	}
}
	

